import time

from selenium import webdriver
from selenium.webdriver.common.by import By

web = webdriver.Edge()
web.implicitly_wait(10)

web.get("https://www.byhy.net/cdn2/files/selenium/sample2.html")

web.switch_to.frame("frame1")    #若没有id和name可以用标签名或者web.find_element(By.CSS_SELECTOR, 'iframe[src="sample1.html"]')
elements = web.find_elements(By.CLASS_NAME, 'plant')

for element in elements:
    print("-----------------------------")
    print(element.get_attribute('outerHTML'))

web.switch_to.default_content()      #切换为外层主html

element = web.find_element(By.ID, "outerbutton").click()
time.sleep(10)
web.quit()